'\" te
.\" Copyright (c) 2001 Sun Microsystems, Inc.  All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SHUTDOWN 8 "May 9, 2001"
.SH NAME
shutdown \- shut down system, change system state
.SH SYNOPSIS
.LP
.nf
\fB/usr/sbin/shutdown\fR [\fB-y\fR] [\fB-g\fR \fIgrace-period\fR] [\fB-i\fR \fIinit-state\fR]
     [\fImessage\fR]
.fi

.SH DESCRIPTION
.sp
.LP
\fBshutdown\fR is executed by the super user to change the state of the
machine. In most cases, it is used to change from the multi-user state (state
2) to another state.
.sp
.LP
By default, \fBshutdown\fR brings the system to a state where only the console
has access to the operating system. This state is called single-user.
.sp
.LP
Before starting to shut down daemons and killing processes, \fBshutdown\fR
sends a warning message and, by default, a final message asking for
confirmation. \fImessage\fR is a string that is sent out following the standard
warning message "The system will be shut down in .\|.\|." If the string
contains more than one word, it should be contained within single (\fB\&'\fR)
or double (\fB"\fR) quotation marks.
.sp
.LP
The warning message and the user provided \fImessage\fR are output when there
are 7200, 3600, 1800, 1200, 600, 300, 120, 60, and 30 seconds remaining before
\fBshutdown\fR begins. See \fBEXAMPLES\fR.
.sp
.LP
System state definitions are:
.sp
.ne 2
.na
\fBstate 0\fR
.ad
.RS 14n
Stop the operating system.
.RE

.sp
.ne 2
.na
\fBstate 1\fR
.ad
.RS 14n
State 1 is referred to as the administrative state. In state 1 file systems
required for multi-user operations are mounted, and logins requiring access to
multi-user file systems can be used. When the system comes up from firmware
mode into state 1, only the console is active and other multi-user (state 2)
services are unavailable. Note that not all user processes are stopped when
transitioning from multi-user state to state 1.
.RE

.sp
.ne 2
.na
\fBstate s, S\fR
.ad
.RS 14n
State s (or S) is referred to as the single-user state. All user processes are
stopped on transitions to this state. In the single-user state, file systems
required for multi-user logins are unmounted and the system can only be
accessed through the console. Logins requiring access to multi-user file
systems cannot be used.
.RE

.sp
.ne 2
.na
\fBstate 5\fR
.ad
.RS 14n
Shut the machine down so that it is safe to remove the power. Have the machine
remove power, if possible. The \fBrc0\fR procedure is called to perform this
task.
.RE

.sp
.ne 2
.na
\fBstate 6\fR
.ad
.RS 14n
Stop the operating system and reboot to the state defined by the
\fBinitdefault\fR entry in \fB/etc/inittab\fR. The \fBrc6\fR procedure is
called to perform this task.
.RE

.SH OPTIONS
.sp
.ne 2
.na
\fB\fB-y\fR\fR
.ad
.RS 19n
Pre-answer the confirmation question so the command can be run without user
intervention.
.RE

.sp
.ne 2
.na
\fB\fB-g\fR\fI grace-period\fR\fR
.ad
.RS 19n
Allow the super user to change the number of seconds from the 60-second
default.
.RE

.sp
.ne 2
.na
\fB\fB-i\fR\fI init-state\fR\fR
.ad
.RS 19n
If there are warnings, \fIinit-state\fR specifies the state \fBinit\fR is to be
in. By default, system state `\fBs\fR' is used.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRUsing \fBshutdown\fR
.sp
.LP
In the following example, \fBshutdown\fR is being executed on host \fBfoo\fR
and is scheduled in 120 seconds. The warning message is output 2 minutes, 1
minute, and 30 seconds before the final confirmation message.

.sp
.in +2
.nf
example# shutdown -i S -g 120 "===== disk replacement ====="
Shutdown started.   Tue Jun   7  14:51:40 PDT  1994

Broadcast Message from root (pts/1) on foo Tue Jun  7 14:51:41.\|.\|.
The system will be shut down in 2 minutes
===== disk replacement =====
Broadcast Message from root (pts/1) on foo Tue Jun  7 14:52:41.\|.\|.
The system will be shut down in 1 minutes
===== disk replacement =====
Broadcast Message from root (pts/1) on foo Tue Jun  7 14:53:41.\|.\|.
The system will be shut down in 30 seconds
===== disk replacement =====
Do you want to continue? (y or n):
.fi
.in -2
.sp

.SH FILES
.sp
.ne 2
.na
\fB\fB/etc/inittab\fR\fR
.ad
.RS 16n
controls process dispatching by \fBinit\fR
.RE

.SH SEE ALSO
.sp
.LP
.BR init.d (5),
.BR inittab (5),
.BR nologin (5),
.BR attributes (7),
.BR boot (8),
.BR halt (8),
.BR init (8),
.BR killall (8),
.BR reboot (8),
.BR ufsdump (8)
.SH NOTES
.sp
.LP
When a system transitions down to the \fBS\fR or \fBs\fR state, the
\fB/etc/nologin\fR file (see \fBnologin\fR(5)) is created. Upon subsequent
transition to state 2 (multi-user state), this file is removed by a script in
the \fB/etc/rc2.d\fR directory.
